package com.mall.user.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.common.domain.R;
import com.mall.user.entity.DO.Member;
import com.mall.user.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户服务相关接口")
@RestController
@RequestMapping("/user/member")
@RequiredArgsConstructor
public class MemberController {

    @Autowired
    private MemberService memberMapper;

    @ApiOperation("会员注册")
    @PostMapping("/regist")
    public R  Registration(Member member){
        return memberMapper.regist(member);
    }


    @ApiOperation("会员登录")
    @PostMapping("/login")
    public R loign(Member member){
        return memberMapper.login(member);
    }

    @ApiOperation("查询全部会员")
    @GetMapping("/queryAll")
    public R queryAll(Page page){
        return memberMapper.queryAll(page);
    }


}
